package com.sopt.eat;

import java.util.ArrayList;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;
import com.sopt.eat.db.EatDBHelper;
import com.sopt.eat.views.ChoicedItemizedOverlay;
import com.sopt.eat.views.HistoryAdapter;
import com.sopt.eat.vo.SearchItem;

public class HistoryActivity extends MapActivity {
	
	private EatDBHelper dbhelper;
	private ListView listView;
	private MapView historyMapView;
	private ChoicedItemizedOverlay choicedItemizedOverlay;

	@Override
	protected void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.history);
		
		listView = (ListView)findViewById(R.id.historyList);
		
		historyMapView = (MapView)findViewById(R.id.historymapview);
		historyMapView.setBuiltInZoomControls(true);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		
		
		dbhelper = new EatDBHelper(this);
		final ArrayList<SearchItem> result = dbhelper.getHistoryList();
		
		HistoryAdapter adapter = new HistoryAdapter(this, R.layout.historyrow, result,choicedItemizedOverlay,historyMapView);
		
		
		listView.setAdapter(adapter);
		
		listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				Log.v("changdoc","Cliecked?");
				
			}
		});
	}
	

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}

}
